package cn.momoshenchi.medicine.pojo;

import com.baomidou.mybatisplus.annotation.*;

import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.Date;

/**
 * 用户表
 * @TableName base_accout
 */
@TableName(value ="base_accout")
public class BaseAccout implements Serializable {
    /**
     * 用户id
     */
    @TableId
    @NotBlank(message = "用户Id不能为空")
    private String userId;

    /**
     * 用户类型，1居民，2医生
     */
    private String userType;

    /**
     * 微信小程序openid
     */
    @NotBlank(message = "openId不能为空")
    private String miniOpenId;

    /**
     * 手机号码
     */
    @NotBlank(message = "手机号码不能为空")
    private String phoneNo;

    /**
     * 创建时间
     */
    @TableField(fill = FieldFill.INSERT)
    private Date createTime;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    /**
     * 用户id
     */
    public String getUserId() {
        return userId;
    }

    /**
     * 用户id
     */
    public void setUserId(String userId) {
        this.userId = userId;
    }

    /**
     * 用户类型，1居民，2医生
     */
    public String getUserType() {
        return userType;
    }

    /**
     * 用户类型，1居民，2医生
     */
    public void setUserType(String userType) {
        this.userType = userType;
    }

    /**
     * 微信小程序openid
     */
    public String getMiniOpenId() {
        return miniOpenId;
    }

    /**
     * 微信小程序openid
     */
    public void setMiniOpenId(String miniOpenId) {
        this.miniOpenId = miniOpenId;
    }

    /**
     * 手机号码
     */
    public String getPhoneNo() {
        return phoneNo;
    }

    /**
     * 手机号码
     */
    public void setPhoneNo(String phoneNo) {
        this.phoneNo = phoneNo;
    }

    /**
     * 创建时间
     */
    public Date getCreateTime() {
        return createTime;
    }

    /**
     * 创建时间
     */
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        BaseAccout other = (BaseAccout) that;
        return (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
            && (this.getUserType() == null ? other.getUserType() == null : this.getUserType().equals(other.getUserType()))
            && (this.getMiniOpenId() == null ? other.getMiniOpenId() == null : this.getMiniOpenId().equals(other.getMiniOpenId()))
            && (this.getPhoneNo() == null ? other.getPhoneNo() == null : this.getPhoneNo().equals(other.getPhoneNo()))
            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
        result = prime * result + ((getUserType() == null) ? 0 : getUserType().hashCode());
        result = prime * result + ((getMiniOpenId() == null) ? 0 : getMiniOpenId().hashCode());
        result = prime * result + ((getPhoneNo() == null) ? 0 : getPhoneNo().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", userId=").append(userId);
        sb.append(", userType=").append(userType);
        sb.append(", miniOpenId=").append(miniOpenId);
        sb.append(", phoneNo=").append(phoneNo);
        sb.append(", createTime=").append(createTime);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}